Skip to content

Check pull requests for edits to generated site files - #1288

Open
LukasWallrich wants to merge 3 commits into
mainfrom
check-generated-paths
Open

LukasWallrich wants to merge 3 commits into
mainfrom
check-generated-paths

Conversation

@LukasWallrich

@LukasWallrich LukasWallrich commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Site generators overwrite hand edits to their outputs. This check flags those changes on PRs into main and rebrand-doors, using the merge base and the actual PR head. It points contributors to the generator or upstream source where known.

Maintainers can apply generated-output to intentional regenerations. Adding or removing the label reruns the check. The data workflow’s same-repository glossary and Google Analytics PRs are exempt based on their verified author and branch names.

Once this reaches rebrand-doors, scripts/rebrand/check_source_rules.py should import the shared path list.

Validated with actionlint and 68 unit tests. Tested the script against the summaries refresh (#1274), the automated glossary update (#1067) and the automated Analytics update (#936).

Created with GPT-6.2 Sol in Codex.

🤖 Generated with Claude Code

@LukasWallrich
LukasWallrich requested a review from a team as a code owner November 22, 2026 10:42
@github-actions

Copy link
Copy Markdown
Contributor

👍 All image files/references (if any) are in webp format, in line with our policy.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Spell Check Passed

No spelling issues found when checking 4 changed file(s)! 🎉

@LukasWallrich

LukasWallrich commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Staging Deployment Status

This PR has been successfully deployed to staging as part of an aggregated deployment.

Deployed at: 2026-11-28 12:00:11 UTC
Staging URL: https://staging.forrt.org

The staging site shows the combined state of all compatible open PRs.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/check_generated_paths.py">

<violation number="1" location="scripts/check_generated_paths.py:21">
P2: This check misses generated newsletter archives, allowing hand edits under `static/newsletters/` to bypass the guard even though the data workflow regenerates and overwrites them. Add `static/newsletters/` to the generated-path alternatives.</violation>

<violation number="2" location="scripts/check_generated_paths.py:23">
P2: The data rule incorrectly treats the hand-maintained lesson-plan data as generated. Exclude `lesson_plans.json` from this pattern so contributors can update the lesson-plan catalog.</violation>
</file>

<file name=".github/workflows/generated-paths.yaml">

<violation number="1" location=".github/workflows/generated-paths.yaml:39">
P1: This runs the checker from the untrusted PR tree, so a contributor can change `scripts/check_generated_paths.py` to ignore generated paths or always exit successfully. Run validation logic from a trusted base revision or keep the policy in a protected workflow/action instead.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

if: steps.exemption.outputs.exempt != 'true'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: python3 scripts/check_generated_paths.py --base "$BASE_SHA"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This runs the checker from the untrusted PR tree, so a contributor can change scripts/check_generated_paths.py to ignore generated paths or always exit successfully. Run validation logic from a trusted base revision or keep the policy in a protected workflow/action instead.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/generated-paths.yaml, line 39:

<comment>This runs the checker from the untrusted PR tree, so a contributor can change `scripts/check_generated_paths.py` to ignore generated paths or always exit successfully. Run validation logic from a trusted base revision or keep the policy in a protected workflow/action instead.</comment>

<file context>
@@ -0,0 +1,39 @@
+        if: steps.exemption.outputs.exempt != 'true'
+        env:
+          BASE_SHA: ${{ github.event.pull_request.base.sha }}
+        run: python3 scripts/check_generated_paths.py --base "$BASE_SHA"
</file context>

r"|content/clusters/cluster-\d+/index\.md$"
r"|content/about/steering-committee/index\.md$"
r"|static/data/"
r"|static/partials/"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This check misses generated newsletter archives, allowing hand edits under static/newsletters/ to bypass the guard even though the data workflow regenerates and overwrites them. Add static/newsletters/ to the generated-path alternatives.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At scripts/check_generated_paths.py, line 21:

<comment>This check misses generated newsletter archives, allowing hand edits under `static/newsletters/` to bypass the guard even though the data workflow regenerates and overwrites them. Add `static/newsletters/` to the generated-path alternatives.</comment>

<file context>
@@ -0,0 +1,82 @@
+    r"|content/clusters/cluster-\d+/index\.md$"
+    r"|content/about/steering-committee/index\.md$"
+    r"|static/data/"
+    r"|static/partials/"
+    r"|scripts/forrt_contribs/contributors_cache\.csv$"
+    r"|data/(?!partners\.json$|publications\.yaml$|themes/|fonts/)[^/]+$)"
</file context>
Suggested change
r"|static/partials/"
r"|static/partials/|static/newsletters/"

Comment thread scripts/check_generated_paths.py Resolved
r"|static/data/"
r"|static/partials/"
r"|scripts/forrt_contribs/contributors_cache\.csv$"
r"|data/(?!partners\.json$|publications\.yaml$|themes/|fonts/)[^/]+$)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The data rule incorrectly treats the hand-maintained lesson-plan data as generated. Exclude lesson_plans.json from this pattern so contributors can update the lesson-plan catalog.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At scripts/check_generated_paths.py, line 23:

<comment>The data rule incorrectly treats the hand-maintained lesson-plan data as generated. Exclude `lesson_plans.json` from this pattern so contributors can update the lesson-plan catalog.</comment>

<file context>
@@ -0,0 +1,82 @@
+    r"|static/data/"
+    r"|static/partials/"
+    r"|scripts/forrt_contribs/contributors_cache\.csv$"
+    r"|data/(?!partners\.json$|publications\.yaml$|themes/|fonts/)[^/]+$)"
+)
+
</file context>
Suggested change
r"|data/(?!partners\.json$|publications\.yaml$|themes/|fonts/)[^/]+$)"
r"|data/(?!lesson_plans\.json$|partners\.json$|publications\.yaml$|themes/|fonts/)[^/]+$)"

Comment thread scripts/check_generated_paths.py Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/check_generated_paths.py">

<violation number="1" location="scripts/check_generated_paths.py:47">
P2: This guidance is incomplete for generated glossary references: those sources live in the Glossary BibTex Google Doc, not the term sheet, and `_create_glossaries.py` runs only with `regenerate_glossary=true`. Distinguish the two sources and tell contributors to manually dispatch `data-processing.yml` with that input.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

PATTERN_SOURCES = (
(r"^data/(featured_resources|pub_cards|filter_tags)\.json$", "the recommendations or publications data used by scripts/build_featured_data.py"),
(r"^content/curated_resources/", "the curated resources Google Sheet, then run content/resources/resource.py"),
(r"^content/glossary/", "the glossary Google Sheet, then rerun glossary generation in the data-processing workflow"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This guidance is incomplete for generated glossary references: those sources live in the Glossary BibTex Google Doc, not the term sheet, and _create_glossaries.py runs only with regenerate_glossary=true. Distinguish the two sources and tell contributors to manually dispatch data-processing.yml with that input.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At scripts/check_generated_paths.py, line 47:

<comment>This guidance is incomplete for generated glossary references: those sources live in the Glossary BibTex Google Doc, not the term sheet, and `_create_glossaries.py` runs only with `regenerate_glossary=true`. Distinguish the two sources and tell contributors to manually dispatch `data-processing.yml` with that input.</comment>

<file context>
@@ -23,30 +23,39 @@
     (r"^content/curated_resources/", "the curated resources Google Sheet, then run content/resources/resource.py"),
-    (r"^content/glossary/", "the glossary Google Sheet, then run content/glossary/_create_glossaries.py and _build_references.py"),
-    (r"^content/post/", "the announcements source used by scripts/create_announcements.R"),
+    (r"^content/glossary/", "the glossary Google Sheet, then rerun glossary generation in the data-processing workflow"),
+    (r"^content/post/", "the FORRT Announcements Google Sheet, then run scripts/create_announcements.R"),
+    (r"^content/contributor-analysis/(?!.*\.Rmd$)", "the Tenzing contributor sheets or the R Markdown under content/contributor-analysis, then rerun the data-processing workflow"),
</file context>
Suggested change
(r"^content/glossary/", "the glossary Google Sheet, then rerun glossary generation in the data-processing workflow"),
(r"^content/glossary/", "the Glossary Google Sheet for terms or the Glossary BibTex Google Doc for references, then manually dispatch data-processing.yml with regenerate_glossary=true"),

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/check_generated_paths.py">

<violation number="1" location="scripts/check_generated_paths.py:29">
P3: The Games Portal mapping misses the checked-in `static/data/open_research_games.json` output, so edits to that generated file still receive only generic `AGENTS.md` guidance. Map both branch-specific output paths to their corresponding generators.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

# Includes the redesign's NEW_OUTPUTS and the summaries generator's output.
OUTPUT_SOURCES = {
"data/summaries.json": "the published FORRT summaries Google Doc, then run content/summaries/summaries.py",
"data/open_research_games.json": (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The Games Portal mapping misses the checked-in static/data/open_research_games.json output, so edits to that generated file still receive only generic AGENTS.md guidance. Map both branch-specific output paths to their corresponding generators.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At scripts/check_generated_paths.py, line 29:

<comment>The Games Portal mapping misses the checked-in `static/data/open_research_games.json` output, so edits to that generated file still receive only generic `AGENTS.md` guidance. Map both branch-specific output paths to their corresponding generators.</comment>

<file context>
@@ -23,30 +23,42 @@
 OUTPUT_SOURCES = {
     "data/summaries.json": "the published FORRT summaries Google Doc, then run content/summaries/summaries.py",
-    "data/open_research_games.json": "the Games Portal source sheet, then run scripts/build_games_portal.py",
+    "data/open_research_games.json": (
+        "the Games Portal source sheet, then run scripts/build_games_portal.py on Doors "
+        "or scripts/open_research_games_portal/Open-Research-Games-Portal.R on main"
</file context>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant